package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.entity.mes.WorkRecord;
import com.zmj.sy.mom.srv.aps.bean.entity.order.ApsWorkDetail;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.part.PartInfoEditReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.part.PartInfoReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.part.PartInfoResVo;
import com.zmj.sy.mom.srv.aps.service.PartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequiredArgsConstructor
@Api(tags = "零件")
@RestController
@RequestMapping("/part")
public class PartController {

    private final PartService partService;

    @ApiOperation("零件详细信息")
    @PostMapping("/info")
    public PartInfoResVo info(@RequestBody PartInfoReqVo reqVo) {
        return partService.info(reqVo);
    }
    @ApiOperation("更新施工号")
    @PostMapping("/edit")
    public BaseResVo edit(@RequestBody PartInfoEditReqVo reqVo) {
         partService.edit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("托盘中的零件")
    @PostMapping("/palletpat")
    public List<PartInfoResVo> palletpat(@RequestBody PartInfoReqVo reqVo) {
        return partService.palletpat(reqVo);
    }

    @ApiOperation("查询领料和预处理工序比切割工序完成数量少的信息")
    @PostMapping("/checkDetailQuantity")
    public BaseListResVo<ApsWorkDetail> checkDetailQuantity() {
        return partService.checkDetailQuantity();
    }

    @ApiOperation("零件报工BZ工序异常信息处理")
    @PostMapping("/fixPartBZPhase")
    public BaseListResVo<WorkRecord> fixPartBZPhase() {
        return partService.fixPartBZPhase();
    }

    @ApiOperation("删除在制品无用信息")
    @PostMapping("/deletePart")
    public BaseResVo deletePart() {
        partService.deletePart();
        return BaseResVo.ok();
    }

}
